﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WinCourseControls
{
    public partial class FrmButton : Form
    {
        public FrmButton()
        {
            InitializeComponent();
        }

        //事件处理程序
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string userName = txtUserName.Text.Trim();
            string pwd = txtPwd.Text.Trim();
            //根据账号、密码到数据库验证账号信息的存在。。。。。。登录过程
            bool bl = true;
            if(bl)
            {
                //登录成功
                MessageBox.Show("登录成功！");
                Form form = new Form();
                form.Text = "系统主页";
                form.WindowState = FormWindowState.Maximized;
                form.Show();
            }
            else
            {
                MessageBox.Show("登录失败！");
                return;
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnLogin_KeyPress(object sender, KeyPressEventArgs e)
        {
            if(e.KeyChar==13)//enter
            {
                btnLogin_Click(btnLogin, new EventArgs());
            }
        }

        //右击
        private void button1_MouseDown(object sender, MouseEventArgs e)
        {
            if(e.Button==MouseButtons.Right)
            {
                MessageBox.Show("你右击了我");
            }
        }
    }
}
